package io.gitee.yxsnake.framework.web.core;

import io.gitee.yxsnake.framework.core.domain.Result;
import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author snake
 * @description
 * @since 2024/11/13 13:21
 */
@Slf4j
@RestController
@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE)
@ConditionalOnProperty(prefix = "web-core.health", name = "enabled", havingValue = "true", matchIfMissing = true)
public class HealthController {

    public HealthController(){
        log.info("健康检查接口已加载.....................");
    }

    @Operation(summary = "健康检查接口")
    @GetMapping("${web-core.health.path:/health}")
    public Result<Void> health() {
        log.info("=================> app health status is ok <===========================");
        return Result.ok();
    }
}
